﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TestEnvirementCL.POCO;
using TestEnvirementCL.Concrete;
using System.Reflection;
namespace TestEnvirementMVC.Controllers
{
    public class EventController : Controller
    {
      private EFDbContext db = new EFDbContext();

      //
      // GET: /Event/

      public ActionResult Index()
      {
        var sports = db.Sports.ToList<Sport>();
        var events = db.Events.ToList<Event>();

        MyChart test = new MyChart();
        String startupPath = Assembly.GetAssembly(typeof(MyChart)).Location;

        test.initialiseDataSerieArray(sports.Count);
        for (int i = 0; i < sports.Count; i++)
        {
          test.countPerName[i] = test.nieuweRij(sports[i].Name, sports[i].Events.Count);
        }

        ViewBag.ListSport = test.countPerName;
        ViewBag.ListAdvertisements = events;
        ViewBag.ListSports = sports;
        ViewBag.Message = "Google Charts Graphs";

        return View();
      }

    }
}
